<?php
namespace Hz\API;


use Snoopy\Snoopy;

class Teambition {
    private $snoopy,$accessToken;
    function __construct(){
        $this->snoopy = new Snoopy();
        $authorizeDataArr = [
            'client_id'=>'6a5b1310-1980-11e5-973a-8d7d552c3be7',
            'redirect_uri'=>'http://mozzos.com/teambition'
        ];
        $this->get('https://account.teambition.com/oauth2/authorize',$authorizeDataArr);
    }
    public function getProjects(){

    }

    private function get($url,array $params){
        $results = $this->snoopy->fetch($url.'?'.$this->urlEncode4Get($params))->results;
        var_dump($results);
    }
    private function urlEncode4Get(array $dataArr){
        $result = '';
        foreach($dataArr as $k=>$v){
            $result .= $k.'='.$v.'&';
        }
        return rtrim($result,'&');
    }
} 